import Vue from 'vue'
import store from '@/store/index'

Vue.directive('permission', {
  inserted (el, binding) {
    const role = binding.value.role
    const userRole = store.getters.GET_ROLE
    // 假如用户没有相关权限则不显示
    if (role.indexOf(userRole) === -1) {
      el.parentElement.removeChild(el)
    }
  }
})
